#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# author: maxiao
# date: 2023-04-01 16:07
# description: 创建子进程

import time
import os
from multiprocessing import Process


def proc(arg):
    print(f"子进程的ID: {os.getpid()}")
    time.sleep(3)
    print(f"主进程传入的参数为: {arg}")
    time.sleep(2)


if __name__ == "__main__":
    print(f"主进程PID{os.getpid()}开始...")
    process = Process(target=proc, args=('hello',))
    process.start()
    process.join()
    print("主进程执行完毕！")



